<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    <title>显示所有权限信息</title>
 	 <style type="text/css">
  body{
		margin: 6px;
		padding: 0;
		font-size: 12px;
		font-family: tahoma, arial;
		background: #fff;
		text-align: center
		
}

table{
		width: 50%;
}
tr.odd{
		background: #fff;
	}
	tr.even{
		background: #eee;
}

div.datagrid_div{
	width: 100%;
	border: 1px solid #999;
}



	/*****************样式2*******************/
	table.datagrid2{
		border-collapse: collapse; 
		margin:auto;
	}
	table.datagrid2 th{
		text-align: center;
		background: #9cf;
		padding: 3px;
		border: 1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:14px;
	}
	table.datagrid2 td{
		padding: 3px;
		border: none;
		border:1px #000000 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:12px;

	}


	/*****************样式5*******************/
	table.datagrid5{
		border-collapse: collapse; 
		margin:auto;
		width:30%;
		
	}
	table.datagrid5 th{
		text-align: left;
		background: #9cf;
		padding: 3px;
		border: 1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:14px;
	}
	table.datagrid5 td{
		padding: 3px;
		border: none;
		border:1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:12px;
		text-align:right;
	}
	
	table.datagrid5 td.right{
		padding: 3px;
		border: none;
		border:1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:12px;
		text-align:left;
	}
	
	


	/*****************************************/

   table.datagrid6{
		border-collapse: collapse; 
		margin:auto;
		width:50%;
		border:1px;
	}
	table.datagrid6 th{
		text-align: left;
		background: #9cf;
		padding: 3px;
		border: 1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:14px;
	}
	table.datagrid6 td{
		padding: 3px;
		border: none;
		border:1px #333 solid;
		font-family: "宋体",Arial, sans-serif;
		font-size:12px;

	}
   









	tr:hover,
	tr.hover{
		background: #9cf;
	}

    a:link { 
     font-weight: bold; 
     text-decoration: none; 
     color: #6C6C6C;
 }
   a:visited { 
     font-weight: bold; 
     text-decoration: none; 
     color: #6C6C6C;
 }
  a:hover, a:active { 
    text-decoration: underline; 
    color: #4A4AFF;
 } 
  </style>
  
  <script type="text/javascript"> 
  function add_event(tr){
			tr.onmouseover = function(){
				tr.className += ' hover';
			};
			tr.onmouseout = function(){
				tr.className = tr.className.replace(' hover', '');
			};
		}

		function stripe(table) {
			var trs = table.getElementsByTagName("tr");
			for(var i=1; i<trs.length; i++){
				var tr = trs[i];
				tr.className = i%2 != 0? 'odd' : 'even';
				add_event(tr);
			}
		}

		window.onload = function(){
			var tables = document.getElementsByTagName('table');
			
			for(var i=0; i<tables.length; i++){
				var table = tables[i];
				if(table.className == 'datagrid1' || table.className == 'datagrid2'
					|| table.className == 'datagrid3' || table.className == 'datagrid4'){
					stripe(tables[i]);
				}
			}
		}		
	
  </script>
  
  
 
  </head>
  
  <body>
   
   <h5 align="center">${sessionScope.roleName}权限设置</h5>
   <form action="" theme="simple">
       <input type="hidden" name="action" value="update" />
                     
       <c:set var="roleID" value="${sessionScope.roleID}" />
   
       <input type="hidden" name="roleID" value="${sessionScope.roleID}" />
  
       <table class="datagrid2" border="1" >
       <c:forEach items="${sessionScope.allRight}"   var="list" varStatus="listStatus">

       <tr>
         <c:set var="rightLists" value="${sessionScope.allRight[listStatus.index]}"/>
            <c:set var="rightColumnNames" value="${rightLists[0]}" />

           <c:forEach items="${rightColumnNames}"   var="list1" varStatus="listStatus1">
               <td>
                       ${list1}
               </td>
           </c:forEach>
       </tr>
       <tr>
       <td>
             <c:set var="rights" value="${rightLists[1]}" />
             <table class="datagrid2" align="center" width="100%">
               <c:forEach items="${rights}"   var="list2" varStatus="listStatus2">
                    <c:set var="rightID" value="rightID"/>
                <tr>
                    <td width="10%"><c:out value="${listStatus2.index+1}"/>、</td><!--  序号 -->
                    <td width="60%"> <c:out  value="${list2.rightName}"/> </td><!--  权限分栏名称 -->
                    <td width="30%">
                      
<%--                      <table  class="datagrid2" >  --%>
<%--                      --%>
<%--                      <tr>--%>
<%--                      <td>--%>
                        <c:set var="iscontain" value="false" />
                        <!-- 原始集合：items，集合元素 ：var-->
                       <c:forEach items="${sessionScope.allRightRole1}" var="element">
                           <!-- 判断测试值是否存在于集合中，存在将iscontain置为true -->
                           <c:if test="${element eq  list2.rightId}">
                              <c:set var="iscontain" value="true" />
                           </c:if>
                       </c:forEach>
                       <!-- 测试值在集合中 -->
                         <c:if test="${iscontain}">
                             <input type="checkbox" name="rightIDs" checked value="${list2.rightId}"  theme="simple"/>
                          </c:if>
                           <c:if test="${!iscontain}" >
                             <input type="checkbox" name="rightIDs" value="${list2.rightId}"  theme="simple"/>
                          </c:if>

<%--                     </td> --%>
<%--                     </tr> --%>
<%--                     </table> --%>
                    </td>
                </tr> 
               </c:forEach>
             </table>
        </td>    
             
         
        
        </tr>
      
       </c:forEach>
     <tr>
       <td colspan="2" align="center"><input type="submit" value="修改"   theme="simple"/></td>
     </tr>
  
   </table> 
   
   </form>
  </body>
</html>
